﻿Imports BUS, DTO
Public Class frmcapnhatnhasanxuat
    Private Sub LoadDSNhaSanXuat()
        dgvDanhSachNhaSanXuat.Rows.Clear()
        Dim bus As New NhaXuatBanBUS()
        Dim dsNSX As New List(Of NhaXuatBanDTO)
        dsNSX = bus.LayDSNhaSanXuat()

        For i As Integer = 0 To dsNSX.Count - 1
            dgvDanhSachNhaSanXuat.Rows.Add(dsNSX(i).MaNhaSanXuat, dsNSX(i).TenNhaSanXuat)
        Next
    End Sub

    Private Sub frmcapnhatnhasanxuat_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadDSNhaSanXuat()
    End Sub

    Private Sub SimpleButton_CapNhat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton_CapNhat.Click
        If dgvDanhSachNhaSanXuat.CurrentRow.Index >= 0 Then
            Dim frm As New frmxlcapnhatnhasanxuat()
            frm.MaNhaSanXuat = dgvDanhSachNhaSanXuat.Item(0, dgvDanhSachNhaSanXuat.CurrentRow.Index).Value
            If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then
                LoadDSNhaSanXuat()
            End If
        Else
            MessageBox.Show("Chưa chọn bằng cấp !")
        End If
    End Sub
End Class